<?php
session_start();
$currentUser=$_SESSION["user"]?$_SESSION["user"]:null;
if)(!$currentUser){
    echo "未登录,请去<a href='login.html'>登录</a>";
    die(0);
}
$title=$_POST["title"];
$content=$_POST["content"];
$authorId=$currentUser["Id"]."";
$authorname=$currentUser["username"];
$now=date_format(new datetime(),'Y-M-D H-I-S');
$sql="INSERT INTO 'article'
('title','content','authorid','authorname','createtime','updatetime')
values
('$title','$content','$authorid','$authorname','$now','$now')";
var_dump($sql);
$conn=new mysqli("localhost",'root','myblood');
$conn->query($sql);
if($conn->error) echo $conn->error;
else{
    echo "添加成功,<a href=''>跳到列表</a>"；
}

?>